<?php
/*
	账户支付
	管理端支付接口
*/

defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'detail';
if($_RQ['op']=='detail'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	$return['cards']=pdo_getall('jy_kaoshi_like',$params,array('id'));
	$return['allnum']=count($return['cards']);
	$return['params']=array('page'=>1);
	$return['danan_key']=$this->danan_key;
	set_html('title','收藏题库');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	if($_RQ['keyword']){
		$params['title like']='%'.trim($_RQ['keyword']).'%';
	}
	//状态为显示的所有活动，排序
	$pindex = max(1, intval($_RQ['page']));
	if($_RQ['num']){
		$psize = $_RQ['num'];
	}else{
		$psize = 1;
	}
	$total='';
	$list=pdo_getslice('jy_kaoshi_like',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if($list){
		foreach($list as &$item){
			$item=pdo_get('jy_kaoshi_tiku',array('id'=>$item['ti_id']));
			$item['xuanxiang']=json_decode($item['xuanxiang'],true);
			$item['images']=json_decode($item['images'],true);
			$item['typetitle']=$this->ti_types[$item['type']];
		}
	}
	$return['list']=$list;
	exi($return);
}